import 'package:coinbaby/common/appbar/appbar.dart';
import 'package:coinbaby/common/const/cosnt.dart';
import 'package:coinbaby/common/refresh/refresh.dart';
import 'package:coinbaby/page/home/view/coincell.dart';
import 'package:coinbaby/page/home/view/homemoney.dart';
import 'package:coinbaby/page/home/view/homesort.dart';
import 'package:flutter/material.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  
  RefreshController _refreshController = RefreshController(initialRefresh: false);

  @override
  void dispose() {
    _refreshController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: SafeArea(
        top: false,
        child: Column(
          children: <Widget>[
            HomeHeaderView(),
            Container(height: 5,color: AppColor.divigrey),
            HomeSortView(),
            Expanded(
              child: RefreshWidget(
                controller: _refreshController,
                child: ListView.separated(
                  itemCount: 30,
                  separatorBuilder: (BuildContext context, int index) => Divider(indent: 15, endIndent: 15,),
                  itemBuilder: (context, index){
                    return CoinCell();
                  }),
              ),
            ),
          ],
        ),
      ),
    );
  }
}